home *** CD-ROM | disk | FTP | other *** search
/ MacHack 1997 / MacHack 1997.toast / Hacks / Hacks ’96 / PredatorPrey / WhichWindow.c < prev    next >
Encoding:
C/C++ Source or Header  |  1996-06-22  |  1.0 KB  |  29 lines  |  [TEXT/KAHL]

  1. /************************************************************************************/
  2. /*    WhichWindow                                                                        */
  3. /*    This routine matches a WindowPtr with an entry in the window table windTbl,    */
  4. /*  returning the subscript of the entry.  Return code is one if a match is not        */
  5. /*  found and zero if a match is found.                                                */
  6. /************************************************************************************/
  7.  
  8. #include "WhichWindow.h"
  9. #ifndef __C14__
  10. #include    "PredatorPrey.h"
  11. #endif
  12.  
  13. void    WhichWindowSeg()    {}
  14.  
  15. short WhichWindow(WindowPtr WhichWindPtr, short * WhichSubscript)
  16. {
  17.     short        j;
  18.     short        WhichWindRetCode = 1;            /* default return code is bad        */
  19.     
  20.     for (j=0; j<windMax; j++)                    /* check the table for..             */
  21.         if (WhichWindPtr == windTbl[j].windPtr)    /* ..a match with pointer            */ 
  22.             {                                    /* if there is a hit..                */
  23.             *WhichSubscript = j;
  24.             WhichWindRetCode = 0;                /*   set return code to good        */
  25.             break;                                /*   get out of the loop            */
  26.             }
  27.  
  28.     return WhichWindRetCode;
  29. }